<?php
/**
 * bs多规格sku商城系统
 * ============================================================================
 * 版权所有 2024-2099 wltx666.com，并保留所有权利。
 * 网站地址: https://wltx666.com
 * ============================================================================
 * Author: 草上飞
 * Email: wltx@alipay168.cn
 * QQ: 2719875001
 * Date: 2024/12/17
 * 描述:
 */

namespace app\api\controller;

use app\result\UserResult;
use think\App;

class User extends BaseIndex
{
    protected $unauthorized = ['user@login', 'user@register', 'user@forget_pwd', 'user@code_login'];

    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->objResult = new UserResult();
    }

    public function login()
    {
        data_exit_json($this->objResult->login($this->param));
    }

    public function code_login()
    {
        data_exit_json($this->objResult->code_login($this->param));
    }

    public function register()
    {
        data_exit_json($this->objResult->register($this->param));
    }

    public function logout()
    {
        data_exit_json($this->objResult->logout($this->token, $this->user_id));
    }

    public function info()
    {
        data_exit_json($this->objResult->info($this->user_id));
    }

    //更新信息
    public function update()
    {
        data_exit_json($this->objResult->update_info($this->user_id, $this->param));
    }

    //更新登录账号
    public function update_account()
    {
        data_exit_json($this->objResult->update_account($this->user_id, $this->param));
    }

    //注销
    public function account_cancel()
    {
        data_exit_json($this->objResult->account_cancel($this->user_id, $this->param));
    }

    //注销-撤回
    public function regret_cancel()
    {
        data_exit_json($this->objResult->regret_cancel($this->user_id, $this->param));
    }

    public function update_password()
    {
        data_exit_json($this->objResult->update_password($this->user_id, $this->param));
    }

    //更新邮箱
    public function update_email()
    {
        data_exit_json($this->objResult->update_email($this->user_id, $this->param));
    }

    public function update_phone()
    {
        data_exit_json($this->objResult->update_phone($this->user_id, $this->param));
    }

    //忘记密码
    public function forget_pwd()
    {
        data_exit_json($this->objResult->forget_password($this->param));
    }

    public function center()
    {
        data_exit_json($this->objResult->center($this->user_id));
    }
}
